Re: Multiple Primary Keys - Mailing list pgsql-novice

From samsom, debra
Subject Re: Multiple Primary Keys
Date
Msg-id 7b06036f040cdd07d2@[10.1.1.200]
Whole thread Raw
In response to Multiple Primary Keys  ("samsom, debra" <dsamsom@bristol.ca>)
List pgsql-novice

You wouldn't believe how long I stared at this and not seen my mistake.  Sometimes it just takes another pair of eyes.  Of course it works now... 

Many thanks :)

-----Original Message-----
From: Josh Berkus [mailto:josh@agliodbs.com]
Sent: Thursday, April 18, 2002 12:47 PM
To: samsom, debra; 'Josh Berkus'; pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Multiple Primary Keys

Debra,

> psql dc postgres -c "create table "attachments"(
>   "docn" varchar(25) NOT NULL,
>   "issue" varchar(6) NOT NULL,
>   "docna" varchar(4) NOT NULL,
>   "issuea" varchar(20) NOT NULL,
>   "applic" varchar(3),
>   "whereused" varchar(1),
>   CONSTRAINT "attachments_pkey"
>   PRIMARY KEY ("docn","issue","docna","issuea"));"
>
> docn                            issue     docna
> issuea
>
> 012T2100 SHT 01             K001 DR 911380
> A001  
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 267
> -001  
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 268
> -001  
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 270
> -001  
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 271
> -001  
> 012T2100 SHT 01             L001 012T2100 SHT 01 ADCN 272
> -001

Here's the reason:  Your table definition and your data do not match.
In your tabledef, docna has 4 characters and issuea has 20.  However,
in your data, docna has 20 characters and issuea has 4.  Fix this, and
you should be able to load your data.

-Josh Berkus

pgsql-novice by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Multiple Primary Keys
Next
From: Mark Thomas
Date:
Subject: libpq - sample code?